home *** CD-ROM | disk | FTP | other *** search
- Path: mozo.cc.purdue.edu!news
- From: hillca@cs.purdue.edu (Chris Hill)
- Newsgroups: comp.os.ms-windows.programmer.tools.misc,comp.os.ms-windows.programmer.win32,comp.os.ms-windows.programmer.misc,comp.lang.c++
- Subject: Re: [Q] Why doesn't this compile?
- Date: 17 Apr 1996 19:43:47 GMT
- Organization: Purdue University
- Message-ID: <4l3hlj$6qt@mozo.cc.purdue.edu>
- References: <317523C0.5042@eps.agfa.be>
- NNTP-Posting-Host: lab40.cs.purdue.edu
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- In article <317523C0.5042@eps.agfa.be>, rorlic@eps.agfa.be says...
- >test.cpp(18) : error C2352: 'A::L::f' : illegal call of
- >nonstatic member function
- >Error executing cl.exe.
- >test.obj - 1 error(s), 1 warning(s)
- >
- >------------------------------------------------
- >
- >Anybody knows what's wrong with it?
- >Thanks,
- >
- >-- Ranko.
-
- I think the error message is telling you exactly what is wrong. You can't call
- A::L::f because it is not a static function. A static function is shared
- between all instances of the class (it only has access to other static
- members), while nonstatic functions all have have access to the instance
- specific data of the class.
-
- A::L::f requires that f is a static function. Which A object do you expect the
- compiler to call f for?
-
- --
- Chris Hill
- hillca@cs.purdue.edu
-
-